GraphQL step definitions
For more information about GraphQL queries and mutations execution refer to Automated Test Platform - User guide - Executing GraphQL queries & mutations ( Extensibility)
The following step definitions are available to execute GraphQL queries and mutations.
the user opens the application on a desktop using the following link: "(.*)"
the user writes "(.*)" GraphQL request
the user clicks the "(.*)" button in the GraphQL page header
the "(.*)" GraphQL response is valid
the user selects the "(.*)" GraphQL property
the selected GraphQL property value is '(.*)'
the selected GraphQL property value is not '(.*)'
the selected GraphQL property value contains '(.*)'
the selected GraphQL property value is
"""
"""
the selected GraphQL property value is not
"""
"""
the selected GraphQL property value contains
"""
"""
the user attaches the actual GraphQL response to allure report
Examples
Extract from sample: 0402B-gql-query-read-customer
Feature: 0402B-gql-query-read-customer
Scenario: Login scenario and connect
Given the user is logged into Sage X3 with "param:loginType" using user name "param:loginUserName" and password param:loginPassword"
And the user changes the main language code to "en-US"
When the user selects the "param:endPointName1" entry on endpoint panel
Then the "param:endPointName1" endpoint is selected
#Redirection to the GraphQL API page
And the user opens the application on a desktop using the following link: "/xtrem/explorer/"
Scenario: Load query request: Read customer NA001
#Write the query into the GraphQL API Page
When the user writes "./0402B-gql- query-read-customer-request.graphql" GraphQL request
#Execute the query
And the user clicks the "Run" button in the GraphQL page header
Scenario: Validate GraphQL response
#Validate the response by comparing the expected response with the actual response from Sage X3.
Then the "./0402B-gql- query-read-customer-response.json" GraphQL response is valid
Scenario: Get and Control GraphQL response Property
#Verify elements of the response
When the user selects the "data.x3MasterData.customer.query.edges[1].node" GraphQL property
Then the selected GraphQL property value is
"""
{
"_id": "NA001",
"code": {
"code": "NA001"
},
"companyNames": {
"query": {
"edges": [
{
"node": {
"companyName": "International Distributors"
}
}
]
}
},
"shortCompanyName": "IntlDist",
"serviceContract": null
}
"""
Then the selected GraphQL property value contains
"""
"_id": "NA001"
"""
Scenario: Get and Check GraphQL single results Property value
When the user selects the "data.x3MasterData.customer.query.edges[1].node.companyNames.query.edges[1].node.companyName" GraphQL property
Then the selected GraphQL property value is "International Distributors"
Extract from sample: 0401A-gql-mutation-time-entry-creation
Feature: 0401A-gql-mutation-time-entry-creation
Scenario; Login scenario and connect
Given the user is logged into Sage X3 with "param:loginType" using user name "param:loginUserRootName" and password "param:loginUserRootPassword"
And the user changes the main language code to "en-US"
When the user selects the "param:endPointName1" entry on endpoint panel
Then the "param:endPointName1" endpoint is selected
#Redirection to the GraphQL API page
And the user opens the application on a desktop using the following link: "/xtrem/explorer/"
Scenario: Load mutation request: Create a time entry for ADMIN User / Project NA0131701000024
#Write the mutation into the GraphQL API page
When the user writes "./0401A-gql-mutation-time-entry-creation-request.graphql" GraphQL request
#Execute the mutation
And the user clicks the "Run" button in the GraphQL page header
Scenario: Attach GraphQL actual response
#Attach the actual response from Sage X3 to allure report
And the user attaches the actual GraphQL response to allure report
Scenario: Get and Control GraphQL response Property
#Verify the mutation returns the expected information
When the user selects the "extensions.diagnoses[1].message" GraphQL property
Then the selected GraphQL property value is not "Error">
Then the selected GraphQL property value is "Operation completed successfully."
Then the selected GraphQL property value contains "successfully"